/**
 * @date 10:59:07 AM
 * EducationStudentQuestionDaoImpl.java
 * Administrator
 * TODO
 */
package com.qs.education.bean.dao.impl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Repository;
import com.qs.education.bean.dao.IEducationStudentQuestionDao;
import com.qs.education.bean.entity.EducationHomeWorkQuestion;
import com.qs.education.bean.entity.EducationStudent;
import com.qs.education.bean.entity.EducationStudentQuestion;
/**
 * @class EducationStudentQuestionDaoImpl	
 * @author Warren
 * @description
 * @date Nov 22, 2018 
 */
@Repository
public class EducationStudentQuestionDaoImpl extends BaseDaoImpl<EducationStudentQuestion> implements IEducationStudentQuestionDao{

	/**
	 * @author Warren
	 * @param education
	 * @param educationHomeWorkQuestion
	 * @return EducationStudentQuestion
	 * @description 根据educationHomeWorkQuestion和educationStudent查询EducationStudentQuestion
	 * @date Nov 22, 2018
	 */
	@Override
	public EducationStudentQuestion findEducationStudentQuestionByStudentAndHomeWorkQuestion(
			EducationStudent educationStudent, EducationHomeWorkQuestion educationHomeWorkQuestion) {
		String jql = "from EducationStudentQuestion eq where eq.student = :student and eq.homeworkQuestion = :homeworkQuestion";
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("student", educationStudent);
		params.put("homeworkQuestion", educationHomeWorkQuestion);
		List<EducationStudentQuestion> result = query(jql, EducationStudentQuestion.class, params);
		if(result!=null && !result.isEmpty()) {
			return result.get(0);
		}
		return null;
	}

}
